# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-binplist
pkgname=('python2-binplist' 'python-binplist')
_pkgname=binplist
pkgver=0.1.4
pkgrel=10
pkgdesc='A binary plist parser.'
arch=('any')
url='https://pypi.org/project/binplist/'
license=('Apache')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://pypi.python.org/packages/d0/0e/51b0e8de64e21313e72eb00f8682528f16eb01f6e63efa6f31a496247e1e/$_pkgname-$pkgver.tar.gz")
sha512sums=('ea2a3836fe25df028030446119224d1fe2d5edfd8b98601c0482bfd680f35e1888c0a8bce0a4d421d3e7e25aa658e633f6248ffbe5e11217068de1cb65507b74')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-binplist() {
  depends=('python2' 'python2-pytz')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build

  mv "$pkgdir/usr/bin/plist.py" "$pkgdir/usr/bin/plist2.py"
}

package_python-binplist() {
  depends=('python' 'python-pytz')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

